/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.struts.Exercise.CorrectExercise;

import com.myapp.model.resueltos.Resueltos;
import com.myapp.model.usuarios.Usuarios;
import com.myapp.svc.Exercise.ExerciseSvc;
import com.myapp.svc.User.UserSvc;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.User;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author jaime
 */
public class CorrectEjerciseAction extends org.apache.struts.action.Action {

    /*
     * forward name="success" path=""
     */
    private static final String SUCCESS = "success";

    
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        Resueltos ejerResolve = new Resueltos();
        ExerciseSvc ejerSvc = new ExerciseSvc();
        
        String ideje=request.getParameter("idej");
        
        ejerResolve=ejerSvc.selectExercResolvePorId(ideje);
        ((CorrectExerciseForm)form).setIdresueltos(ejerResolve.getIdresueltos());
        ((CorrectExerciseForm)form).setCodigo(ejerResolve.getCodigo());
        
        request.setAttribute("ejerResuelto", ejerResolve);
        
        
        
        
        return mapping.findForward(SUCCESS);
    }
}
